package refactor.removecontrolflag;

public class RemoveControlFlagExampleOriginal {
    public boolean checkSecurity(String[] people) {
        boolean sendAlert = false;
        boolean found = false;
        for (int i = 0; i < people.length; i++) {
            if (!found) {
                if (people[i].equals("sam")) {
                    sendAlert = sendAlert();
                    found = true;
                }
                if (people[i].equals("tom")) {
                    sendAlert = sendAlert();
                    found = true;
                }
            }
        }
        return sendAlert;
    }

    public String findMiscreant(String[] people) {
        String found = "";
        for (int i = 0; i < people.length; i++) {
            if (found.equals("")) {
                if (people[i].equals("sam")) {
                    sendAlert();
                    found = "sam";
                }
                if (people[i].equals("tom")) {
                    sendAlert();
                    found = "tom";
                }
            }
        }
        return found;
    }

    public boolean sendAlert() {
return true;
    }

}
